package o2o.config.properties;

import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * Created with IntelliJ IDEA.
 * User: Jahnke [1029777564@qq.com]
 * Date: 2018-08-14 9:54
 * To change this template use File | Settings | File Templates.
 */
@Component
@ConfigurationProperties(prefix = "user-server.pro")
public class ConfigProperties {

    private String projectName;
    private String flag;
    private String temp;
    private String shareImgUrl; // 分享商品背景图
    private String tokenKey;
    private String evn;
    private Boolean registerHx = true;// 是否注册到环信

    // Jahnke 2020年9月11日 10:23:44
    public boolean isProdEvn() {
        return StringUtils.isNotEmpty(evn) && evn.equals("test") ? false : true;
    }

    public String getProjectName() {
        return projectName;
    }

    public ConfigProperties setProjectName(String projectName) {
        this.projectName = projectName;
        return this;
    }

    public String getFlag() {
        return flag;
    }

    public ConfigProperties setFlag(String flag) {
        this.flag = flag;
        return this;
    }

    public String getTemp() {
        return temp;
    }

    public void setTemp(String temp) {
        this.temp = temp;
    }

    public String getShareImgUrl() {
        return shareImgUrl;
    }

    public ConfigProperties setShareImgUrl(String shareImgUrl) {
        this.shareImgUrl = shareImgUrl;
        return this;
    }

    public String getTokenKey() {
        if (null == tokenKey) {
            tokenKey = "on_";
        }
        return tokenKey;
    }

    public ConfigProperties setTokenKey(String tokenKey) {
        this.tokenKey = tokenKey;
        return this;
    }

    public String getEvn() {
        return evn;
    }

    public ConfigProperties setEvn(String evn) {
        this.evn = evn;
        return this;
    }

    public Boolean getRegisterHx() {
        return registerHx;
    }

    public void setRegisterHx(Boolean registerHx) {
        this.registerHx = registerHx;
    }
}
